package org.chen.model.sys;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.chen.constants.ImageStatus;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

@Data
@Document(collection = "image_resources")
public class ImageResource {
    @Id
    private String id;
    private String fileName;      // 文件名
    private String url;          // 访问URL
    private String originalName; // 原始文件名
    private String type;        // 图片类型 (ADMIN/CRAWLER)
    private ImageStatus status;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;    // 创建时间
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    private String path;        // 存储路径
    private Long size;         // 文件大小
    private String md5;        // 文件MD5，用于去重
    private Boolean isDeleted; // 软删除标记
    private String errorMessage;
    private String articleId;
}